package cc.autoapi.pucong.auto.flow.core.root.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class UUID {

    public static void main(String[] args) {


    }

    public static String uuid() {
        String result = "";
        synchronized (result) {
            result = java.util.UUID.randomUUID().toString();
        }
        return result.replaceAll("-", "");
    }

    public static String getSerializName() {
        String s = "abcdefghijklmnopqrstuvwxyz";
        char[] c = s.toCharArray();
        StringBuffer stringBuffer = new StringBuffer();
        Random random = new Random();
        for (int i = 0; i < 8; i++) {
            stringBuffer.append(c[random.nextInt(c.length)]);
        }
        return stringBuffer.toString();
    }

    /**
     * 获取根据当前时间生成的一个序号,例如：20170921154243425
     *
     * @return
     */
    public static String getSerializNo() {
        Date nowDate = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String nowString = format.format(nowDate);
        return nowString;
    }
}
